package com.itheima.youdianda.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.itheima.youdianda.domain.YddArticle;
import com.itheima.youdianda.dto.qiantaiDto.ArticlePageDto;
import com.itheima.youdianda.service.YddArticleService;
import com.itheima.youdianda.mapper.YddArticleMapper;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service;

/**
* @author YUAN
* @description 针对表【ydd_article】的数据库操作Service实现
* @createDate 2022-09-06 18:36:39
*/
@Service
public class YddArticleServiceImpl extends ServiceImpl<YddArticleMapper, YddArticle>
    implements YddArticleService{

    @Override
    public int getCateNum(Object id) {
        return baseMapper.getCateNum(id);
    }

    @Override
    public ArticlePageDto getArticlePageDto(int page, int limit, LambdaQueryWrapper<YddArticle> qw) {
        Page pageInfo = new Page(page, limit);
        this.page(pageInfo, qw);

        ArticlePageDto articlePageDto = new ArticlePageDto();
        BeanUtils.copyProperties(pageInfo, articlePageDto);
        return articlePageDto;
    }
}




